test: cover unit of work generator hosts#428
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR expands the Unit of Work source generator’s correctness surface (notably for nested generator hosts) while converting the UnitOfWork generator test suite to TinyBDD xUnit scenarios to significantly increase coverage.
Changes:
- Updated
UnitOfWorkGeneratorto emit containing-type wrapper declarations so nested[GenerateUnitOfWork]hosts generate into the correct nested scope. - Reworked
UnitOfWorkGeneratorTestsinto TinyBDD scenarios and expanded coverage across ordering, diagnostics, escaping, host shapes, nested accessibility wrappers, and emit success.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/PatternKit.Generators/UnitOfWork/UnitOfWorkGenerator.cs |
Emits containing-type wrappers and refactors emission indentation to support nested generator hosts. |
test/PatternKit.Generators.Tests/UnitOfWorkGeneratorTests.cs |
Converts tests to TinyBDD xUnit scenarios and adds broader diagnostic + emission coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (type.IsStatic) | ||
| sb.Append("static "); | ||
| else if (type.IsAbstract && type.TypeKind == TypeKind.Class) | ||
| sb.Append("abstract "); | ||
| else if (type.IsSealed && type.TypeKind == TypeKind.Class) | ||
| sb.Append("sealed "); | ||
| sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name); |
| var containingTypes = GetContainingTypes(type); | ||
| var indentLevel = 0; | ||
| foreach (var containingType in containingTypes) | ||
| { | ||
| AppendTypeDeclaration(sb, containingType, indentLevel); |
Test Results 12 files 12 suites 9m 54s ⏱️ Results for commit a964cb9. |
Code Coverage |
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #428 +/- ##
==========================================
+ Coverage 90.18% 96.05% +5.87%
==========================================
Files 551 551
Lines 44291 44311 +20
Branches 6373 6376 +3
==========================================
+ Hits 39945 42565 +2620
+ Misses 1884 1746 -138
+ Partials 2462 0 -2462
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary:
Coverage:
Validation:
Closes part of #413.